package com.zqxq.lottery.api.controller;

import com.zqxq.common.constant.Result;
import com.zqxq.lottery.api.feign.LotteryServerFeignClient;
import com.zqxq.lottery.entity.vo.user.UserAddressVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@Api(value = "地址接口",tags = "地址接口")
@RestController
@Slf4j
@RequestMapping(value = "/address", produces = "application/json")
public class AddressController {
    @Autowired
    private LotteryServerFeignClient lotteryServerFeignClient;
    @ApiOperation("获取收货地址信息")
    @PostMapping("/get")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "地址ID", paramType = "query", dataType = "Long", required = true)
    })
    public Result getAddressById(String id){
        return lotteryServerFeignClient.getAddressById(id);
    }

    @ApiOperation("保存收货地址")
    @PostMapping("/save")
    public Result saveAddress(UserAddressVO vo){
        return lotteryServerFeignClient.saveAddress(vo);
    }
}
